package com.falcon.sathu.mungmu;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class BaseActivity extends Activity {
	public static boolean onPause = false;
	public static boolean onResume = false;
	protected Boolean volumnOn = true;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		onPause = false;
		onResume = true;
		if (volumnOn) {
			startService(new Intent(this, BackgroundMusic.class));
			volumnOn = false;
		}
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		if (!onResume) {
			try {
				stopService(new Intent(this, BackgroundMusic.class));
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();
			}
		}
	}

	@Override
	protected void onStart() {
		super.onStart();
	}

	@Override
	protected void onPause() {
		super.onPause();
		onPause = true;
		onResume = false;
	}

	@Override
	protected void onRestart() {
		super.onRestart();
	}
}
